# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
pkgname=rasdaemon
pkgver=0.6.5
pkgrel=0
pkgdesc="utility to receive RAS error tracings"
url="http://www.infradead.org/~mchehab/rasdaemon/"
arch="x86_64"
license="GPL-2.0-or-later"
depends="dmidecode
	perl
	perl-dbd-sqlite
	"
makedepends="argp-standalone
	sqlite-dev
	autoconf
	automake
	libtool
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
source="https://www.infradead.org/~mchehab/rasdaemon/rasdaemon-$pkgver.tar.bz2
	libargp.patch
	$pkgname.initd
	"

prepare() {
	default_prepare
	autoreconf -i
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-abrt-report \
		--enable-aer \
		--enable-devlink \
		--enable-diskerror \
		--enable-extlog \
		--enable-hisi-ns-decode \
		--enable-mce \
		--enable-non-standard \
		--enable-sqlite3
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
}

sha512sums="aa781f3148ae32c8bc7ff8007574912454180725b9b102e1c7c583101dd1fd96debbdc78f3f2a35db45df359c7547cad4d87b490af66f444341c0dc8429c1310  rasdaemon-0.6.5.tar.bz2
83a484ab7b19dc22c2dae7636929379a70d775194566ee98012a783c7a2afa0b216ebe8b49f34f05bfe395f8f1e434ca7e739991943514faf3888689a284b781  libargp.patch
edee5b32765b3c89ab82e5cd410b0b381aa58470fdaed3a94516aa954845123b661a4923435f7d0bc9c33fb9b1e42a611dc1aa629a5db7d3e431164e4cd432cf  rasdaemon.initd"
